function msg = jstegd_simple(img)
    % JSTEGD_SIMPLE  Extract message using JSTEG.
    % MSG = JSTEGD_SIMPLE(IMG) extracts message from IMG, and return the 
    % message body. It automatically calls BINARYTOARRAY to get the 
    % original message. IMG is a N*64 matrix, each line represents a 8x8 
    % block in DCT-coefs.
    %
    
    r = int16(im2vec(img, [8 8])');    
    [M,N] = size(r);
    bin = zeros(1,M*N);
    
    % get all LSB
    count = 1;
    for i=1:M
        for j=1:N
            if (r(i,j) ~= 0) && (r(i,j) ~= 1)
                bin(count) = mod(r(i,j),2);
                count = count + 1;
            end
        end
    end
    
    count = count - 1;
    
    % output
    msg = binaryToArray(bin, count);
    fprintf(1, 'recovered message is: %s',msg);
end
